echo " Installing Symfony 2.0 and PHP5."
echo " Please be patient..."
echo -e "\e[00;36m-------------------------------------------------------------------------------\e[00m"
echo ""

#Install PHP5, Apache2 and SQLite
tce-load -wi tcl.tcz
tce-load -wi Xorg-7.7-lib.tcz
tce-load -wi tk.tcz
tce-load -wi openssl-1.0.0.tcz
tce-load -wi ncurses-common.tcz
tce-load -wi ncurses.tcz
tce-load -wi libedit.tcz
tce-load -wi gdbm.tcz
tce-load -wi sqlite3.tcz
tce-load -wi php5.tcz
tce-load -wi apache2.tcz
tce-load -wi apache2-mod-php5.tcz

#Required fiddling to create the libodbc.so.1 file expected by the framework
sudo ln -s /usr/local/lib/libodbc.so /usr/local/lib/libodbc.so.1
#Required fiddling to have everything accessible from /home/tc/sydocs (where the persistence is set) whitout modifying the apache conf file
ln -s /usr/local/apache2/htdocs /home/tc/sydocs
#Removing apc.so from the php modules (too old for the framework and throws a major error)
sudo mv /usr/local/lib/php/extensions/no-debug-zts-20100525/apc.so /usr/local/lib/php/extensions/no-debug-zts-20100525/apc.so.REMOVED

#INSTALL SYMFONY (takes a while)
cd /home/tc/sydocs
wget http://symfony.com/download?v=Symfony_Standard_Vendors_2.3.5.tgz
tar xzvf Symfony_Standard_Vendors_2.3.5.tgz

#More fiddling to remove the hard-coded localhost limitation in the following framework files
cd /home/tc/sydocs/Symfony/web/
wget http://tinycorelinux-scripts.googlecode.com/svn/trunk/ingredients/symfony2_framework/app_dev.php
wget http://tinycorelinux-scripts.googlecode.com/svn/trunk/ingredients/symfony2_framework/config.php

#And more fiddling to set up the cache and logs directories as writable
chmod -R 777 /home/tc/sydocs/Symfony/app/cache
chmod -R 777 /home/tc/sydocs/Symfony/app/logs
chmod 777 /home/tc/sydocs/Symfony/app/config/parameters.yml

sudo /usr/local/bin/apachectl -k start

# Setting up persistence
echo "home/tc/sydocs" >> /opt/.filetool.lst
echo "usr/local/apache2/htdocs" >> /opt/.filetool.lst
echo "usr/local/apache2/conf/httpd.conf" >>/opt/.filetool.lst
echo "usr/local/apache2/conf/httpd-vhosts.conf" >>/opt/.filetool.lst

# Backup
filetool.sh -b >> /dev/null
exit

